package thread;

public class InterruptThread extends Thread {


    public static void main(String[] args) throws InterruptedException {
        InterruptThread thread = new InterruptThread();
        thread.start();
        thread.interrupt();
        Thread.sleep(2000);
    }
    @Override
    public void run() {
        while (true){
            System.out.println("-------");
            if (this.isInterrupted()){
                System.out.println("线程是中断状态要退出循环");
                break;
            }
        }
    }
}


